import { RouteType } from '.'
import NotFoundPage from '@/404'
import App from '@/App'
import Permission from '@/components/permissions/Permission'
import ErrorPage from '@/ErrorPage'
import ComponManagement from '@/pages/accessManagement/ComponManagement'
import ResourceManangement from '@/pages/accessManagement/ResourceManangement'
import Resource from '@/pages/accessManagement/ResourceManangement/Resource'
import RoleManangement from '@/pages/accessManagement/RoleManangement'
import UserManagement from '@/pages/accessManagement/UserManagement'

// 企业管理
import StaffManagement from '@/pages/enterpriseManagement/StaffManagement'
import StaffManagementEdit from '@/pages/enterpriseManagement/StaffManagement/edit'
import RoleManagement from '@/pages/enterpriseManagement/RoleManagement'
import RoleManagementAdd from '@/pages/enterpriseManagement/RoleManagement/add'
import DepartmentManagement from '@/pages/enterpriseManagement/DepartmentManagement'
import DepartmentManagementAdd from '@/pages/enterpriseManagement/DepartmentManagement/add'
import TenantManagement from '@/pages/enterpriseManagement/TenantManagement'
import TenantManagementAdd from '@/pages/enterpriseManagement/TenantManagement/add'
import PostManagement from '@/pages/enterpriseManagement/PostManagement'
import PostManagementAdd from '@/pages/enterpriseManagement/PostManagement/add'
import MenuManagement from '@/pages/enterpriseManagement/MenuManagement'
import MenuManagementAdd from '@/pages/enterpriseManagement/MenuManagement/add'
// 字典管理
import DictManagement from '@/pages/dictMg'
import AddDict from '@/pages/dictMg/addDict'
import AddField from '@/pages/dictMg/addField'
// 国际化管理
import InternationalMg from '@/pages/internationalMg'
import AddIN from '@/pages/internationalMg/add'
// 终端管理
import TerminalManagement from '@/pages/terminalManagement'
// app版本管理
import AppVersionManagement from '@/pages/appVersionManagement'
import AddAppVersion from '@/pages/appVersionManagement/addAppVersion'
import Home from '@/pages/Home'
import Login from '@/pages/Login'
import TestChild from '@/pages/Test/TestChild'
import { Navigate } from 'react-router-dom'

// 管理操作日志
import ManagementOperations from '@/pages/logManagement/managementOperations'
import ManagementOperationsDetails from '@/pages/logManagement/managementOperations/details'
import UserOperations from '@/pages/logManagement/userOperations/userOperations'
import User from '@/pages/User'
import Data from '@/pages/Data'
import Sport from '@/pages/Sport'
import Entertainment from '@/pages/Entertainment'
import Transaction from '@/pages/Transaction'
import Marketing from '@/pages/Marketing'
import Agent from '@/pages/Agent'
import { UnorderedListOutlined } from '@ant-design/icons'

export const routers = [
  {
    path: '/',
    /** 重定向 */
    element: <Navigate replace to="/home" />
  },
  {
    path: '/',
    /** 承载布局 */
    element: <App />,
    errorElement: <ErrorPage />,
    children: [
      /** 布局下路由，页面路由在该children配置 */
      {
        path: '/home',
        name: '首页',
        element: <Home />,
        permissionObj: true
      },
      {
        path: '/user',
        name: '用户',
        element: <User />,
        permissionObj: true
      },
      {
        path: '/data',
        name: '数据',
        element: <Data />,
        permissionObj: true
      },
      {
        path: '/sport',
        name: '体育',
        element: <Sport />,
        permissionObj: true
      },

      {
        path: '/entertainment',
        name: '娱乐',
        element: <Entertainment />,
        permissionObj: true
      },
      {
        path: '/transaction',
        name: '交易',
        element: <Transaction />,
        permissionObj: true
      },
      {
        path: '/marketing',
        name: '营销',
        element: <Marketing />,
        permissionObj: true
      },
      {
        path: '/agent',
        name: '代理',
        element: <Agent />,
        permissionObj: true
      },
      {
        path: '/risk',
        name: '风控',
        element: <Agent />,
        permissionObj: true
      },

      {
        path: '/setting',
        name: '设置',
        permissionObj: true,
        children: [
          {
            path: '/setting',
            /** 重定向 */
            element: <Navigate replace to="/setting/accessManagement" />
          },
          {
            path: '/setting/accessManagement',
            name: '权限管理',
            permissionObj: true,
            icon: <UnorderedListOutlined />,
            children: [
              {
                path: '/setting/accessManagement',
                /** 重定向 */
                element: <Navigate replace to="/setting/accessManagement/userManagement" />
              },
              {
                path: '/setting/accessManagement/userManagement',
                name: '用户管理',
                permissionObj: true,
                element: <UserManagement />
              },
              {
                path: '/setting/accessManagement/roleManagement',
                name: '角色管理',
                permissionObj: true,
                element: <RoleManangement />
              },
              {
                path: '/setting/accessManagement/componentManagement',
                name: '组件管理',
                permissionObj: true,
                element: <ComponManagement />
              },
              {
                path: '/setting/accessManagement/resourceManagement',
                name: '资源管理',
                permissionObj: true,
                children: [
                  {
                    path: '/setting/accessManagement/resourceManagement',
                    /** 重定向 */
                    element: (
                      <Navigate
                        replace
                        to="/setting/accessManagement/resourceManagement/resourceCategory"
                      />
                    )
                  },
                  {
                    path: '/setting/accessManagement/resourceManagement/resourceCategory',
                    name: '资源分类',
                    permissionObj: true,
                    element: <ResourceManangement />,
                    hideInMenu: true
                  },
                  {
                    path: '/setting/accessManagement/resourceManagement/resourceCategory/:resourceCategoryId/resource',
                    name: '资源列表',
                    permissionObj: true,
                    element: <Resource />,
                    hideInMenu: true
                  }
                ]
              }
            ]
          },
          {
            path: '/setting/enterpriseManagement',
            name: '企业管理',
            permissionObj: true,
            icon: <UnorderedListOutlined />,
            children: [
              {
                path: '/setting/enterpriseManagement',
                /** 重定向 */
                element: <Navigate replace to="/setting/enterpriseManagement/staffManagement" />
              },
              {
                path: '/setting/enterpriseManagement/staffManagement',
                name: '员工管理',
                permissionObj: true,
                element: <StaffManagement />
              },
              {
                path: '/setting/enterpriseManagement/menuManagement',
                name: '菜单管理',
                permissionObj: true,
                element: <MenuManagement />
              },
              {
                path: '/setting/enterpriseManagement/roleManagement',
                name: '角色管理',
                permissionObj: true,
                element: <RoleManagement />
              },
              {
                path: '/setting/enterpriseManagement/roleManagement/add',
                name: '新增角色',
                permissionObj: true,
                hideInMenu: true,
                element: <RoleManagementAdd />
              },
              {
                path: '/setting/enterpriseManagement/departmentManagement',
                name: '部门管理',
                permissionObj: true,
                element: <DepartmentManagement />
              },
              {
                path: '/setting/enterpriseManagement/tenantManagement',
                name: '租户管理',
                permissionObj: true,
                element: <TenantManagement />
              },
              {
                path: '/setting/enterpriseManagement/postManagement',
                name: '岗位管理',
                permissionObj: true,
                element: <PostManagement />
              },
              {
                path: '/setting/enterpriseManagement/postManagement/add',
                name: '新增岗位',
                permissionObj: true,
                hideInMenu: true,
                element: <PostManagementAdd />
              }
            ]
          },
          {
            path: '/setting/dictMg',
            name: '字典管理',
            element: <DictManagement />,
            icon: <UnorderedListOutlined />,
            permissionObj: true,
          },
          {
            path: '/setting/dictMg/add',
            name: '新增字典',
            element: <AddDict />,
            hideInMenu: true,
            hideLayout: false,
          },
          {
            path: '/setting/dictMg/addField',
            name: '新增字段',
            element: <AddField />,
            hideInMenu: true,
            hideLayout: false,
          },
          {
            path: '/setting/internationalMg',
            name: '国际化管理',
            element: <InternationalMg />,
            icon: <UnorderedListOutlined />,
            permissionObj: true,
          },
          {
            path: '/setting/internationalMg/add',
            name: '新增国际化',
            element: <AddIN />,
            hideInMenu: true,
            hideLayout: false,
          },
          {
            path: '/setting/terminalMg',
            name: '终端管理',
            element: <TerminalManagement />,
            icon: <UnorderedListOutlined />,
            permissionObj: true
          },
          {
            path: '/setting/appVersionManagement',
            name: 'App版本管理',
            element: <AppVersionManagement />,
            icon: <UnorderedListOutlined />,
            permissionObj: true
          },
          {
            path: '/setting/appVersionManagement/add',
            name: '新增版本',
            hideInMenu: true,
            hideLayout: false,
            element: <AddAppVersion />
          },
          {
            path: '/setting/appVersionManagement/edit',
            name: '修改版本',
            hideInMenu: true,
            hideLayout: false,
            element: <AddAppVersion />
          },
          {
            path: '/setting/layoutNone',
            name: '布局隐藏',
            hideInMenu: true,
            hideLayout: true,
            element: <TestChild />
          },
          {
            path: '/setting/logManagement',
            name: '日志管理',
            permissionObj: true,
            icon: <UnorderedListOutlined />,
            children: [
              {
                path: '/setting/logManagement',
                /** 重定向 */
                element: <Navigate replace to="/setting/logManagement/managementOperations" />
              },
              {
                path: '/setting/logManagement/managementOperations',
                name: '管理操作日志',
                permissionObj: true,
                element: <ManagementOperations />
              },

              {
                path: '/setting/logManagement/managementOperations/details/:id',
                name: '管理操作日志详情',
                permissionObj: true,
                element: <ManagementOperationsDetails />,
                hideInMenu: true
              },
              {
                path: '/setting/logManagement/userOperations',
                name: '用户操作日志',
                permissionObj: true,
                element: <UserOperations />
              },
              {
                path: '/setting/logManagement/agentOperations',
                name: '代理操作日志',
                permissionObj: true,
                element: <UserOperations />
              }
              // hideInMenu: true
            ]
          },
          {
            path: '/setting/enterpriseManagement/staffManagement/edit',
            name: '新增员工',
            hideInMenu: true,
            hideLayout: false,
            element: <StaffManagementEdit />
          },
          {
            path: '/setting/enterpriseManagement/menuManagement/add',
            name: '新增菜单',
            hideInMenu: true,
            hideLayout: false,
            element: <MenuManagementAdd />
          },
          {
            path: '/setting/enterpriseManagement/departmentManagement/add',
            name: '新增部门',
            hideInMenu: true,
            hideLayout: false,
            element: <DepartmentManagementAdd />
          },
          {
            path: '/setting/enterpriseManagement/tenantManagement/add',
            name: '新增租户',
            hideInMenu: true,
            hideLayout: false,
            element: <TenantManagementAdd />
          },
        ]
      }
    ]
  },
  {
    path: '/login',
    name: '登录',
    element: <Login />
  },
  { path: '*', element: <NotFoundPage /> }
] as RouteType[]
